import Vue from 'vue'
import VueRouter from 'vue-router'


//解决路由的问题（警告提示）--专门给程序员看的  可以选择不改
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)
//引入路由组件
import Login from '../views/Login.vue'
import Search from '../views/Search.vue'
import Play from '../views/Play.vue'
const routes = [
  {
    path: '/',
    component: Login,
    redirect:'/login',
  },
  
  {
    path: '/login',
    component: Login
  },
  {
    path: '/',
    component: Login,
    redirect:'/search',
    children:[{
      path:'/search',
      component:()=>import('@/views/Search.vue')
    }]
  },
  {
    path:'/',
    component:Login,
    redirect:'/play',
    children:[{
      path:'/play',
      component:()=>import('@/views/Play.vue')
    }]
  }
  
]

const router = new VueRouter({
  routes
})

export default router
